﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models;

namespace MvcApplication1.Controllers
{
    public class TrangChuController : Controller
    {
        //
        // GET: /TrangChu/
        ThuongMaiDienTuEntities1 _db = new ThuongMaiDienTuEntities1();
    
        public ActionResult Index()
        {

            string chuoi = "";
            var product = (from p in _db.SanPhams select p).Take(8).ToList();
            for (int i = 0; i < product.Count; i++)
            {
                chuoi += "<div>";
                chuoi += "<p>\""+product[i].name+"</p>";
                chuoi += "</div>";

            }
            ViewBag.views = chuoi;
                return View();
        }

    }
}
